<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>JhERP 登录页面</title>
  <style>
    body {
      display: flex;
      align-items: center;
      justify-content: flex-end; /* 将内容靠右对齐（适用于桌面设备） */
      height: 90vh;
      background-color: #f5f5f5;
      background-image: url('{{ url_for('static', filename='img/BG.jpg') }}'); /* 添加背景图片 */
      background-repeat: no-repeat; /* 不重复背景图片 */
      background-size: cover; /* 使背景图片覆盖整个页面 */
    }

    @media (max-width: 600px) {
      body {
        justify-content: center; /* 在手机上居中对齐 */
      }
    }

    form {
      background-color: #fff;
      padding: 20px;
      border-radius: 5px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      animation: form-animation 0.5s ease-in-out;
      width: 300px;
      margin-right: 20%; /* 设置表单右边的外边距（适用于桌面设备） */
    }

    @media (max-width: 600px) {
      form {
        margin-right: 0; /* 在手机上移除右边的外边距 */
      }
    }

    @keyframes form-animation {
      0% {
        opacity: 0;
        transform: translateY(-20px);
      }

      100% {
        opacity: 1;
        transform: translateY(0);
      }
    }

    h2 {
      color: #333;
      margin-bottom: 20px;
      text-align: center;
    }

    input[type="text"],
    input[type="password"] {
      width: 100%;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 3px;
      margin-bottom: 10px;
      font-size: 16px;
      box-sizing: border-box;
      padding-right: 20px;
    }

    input[type="submit"] {
      background-color: #4CAF50;
      color: #fff;
      padding: 10px 20px;
      border: none;
      border-radius: 3px;
      cursor: pointer;
      font-size: 16px;
    }

    input[type="submit"]:hover {
      background-color: #45a049;
    }

    {% if error_message %}
    p {
      color: red;
      text-align: center;
    }
    {% endif %}
  </style>
</head>

<body>
  <form action="/login" method="post">
    <h2 class="form-title">JhERP 登录</h2>
    <input type="text" id="username" name="username" placeholder="用户名" required>
    <input type="password" id="password" name="password" placeholder="密码" required>
    <input type="submit" value="登录">
    {% if error_message %}
    <p>{{ error_message }}</p>
    {% endif %}
  </form>
</body>

</html>